import axios from 'axios'
import mpAdapter from 'axios-miniprogram-adapter'
axios.defaults.adapter = mpAdapter
Page({

  /**
   * 页面的初始数据
   */
  data: {
    syitem: ['首页', '生活', '娱乐', '健康', '精选', '文化'],
    xwsj: [],
    xwsj1: [],
    xwsj2: [],
    xwsj3: [],
    xwsj4: [],
    xwsj5: [],
    xzitem: 0,
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    function postJson(url, data) {
      return axios.post(url, data, {
        headers: {
          'Content-Type': 'application/json'
        }
      });
    }
    postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "d2aecbfbf46a4ecb21c1c48508b8db46bf564f53", "timestamp": 1677228794, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
      .then((res) => {
        var now = Date.now() / 1000;
        function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
        function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
        function timestampToRelative(timestamp) {
          var delta = now - timestamp;
          if (delta < 60) {
            return "刚刚";
            // 如果时间差小于3600秒（1小时），返回“x分钟前”
          } else if (delta < 3600) {
            return Math.floor(delta / 60) + "分钟前";
            // 如果时间差小于86400秒（1天），返回“x小时前”
          } else if (delta < 86400) {
            return Math.floor(delta / 3600) + "小时前";
            // 如果时间差小于604800秒（7天），返回“x天前”
          } else if (delta < 604800) {
            return Math.floor(delta / 86400) + "天前";
            // 否则，返回完整的日期字符串
          } else {
            return dateToString(timestampToDate(timestamp));
          }
        }
        res.data.data.filter(e => {
          e.publish_time = timestampToRelative(e.publish_time)
        })
        this.setData({
          xwsj: res.data.data
        })
      })



  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    if (this.data.xzitem == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "34eb00b0d73d4c4e221b29c237cf41c8dad2573b", "timestamp": 1677361939, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj: res.data.data
          })
        })
    }
    if (this.data.xzitem == 1) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "866eb6711973721b4de43ab9d9e10f05cb28c149", "timestamp": 1677362000, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj1: res.data.data
          })
        })
    }
    if (this.data.xzitem == 2) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "ca5e21d72eddb18647a8e846574ad607880b49d9", "timestamp": 1677362078, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj2: res.data.data
          })
        })
    }
    if (this.data.xzitem == 3) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "c95c2da8c303794098d5e86aa447fbbe95a73f4e", "timestamp": 1677362108, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj3: res.data.data
          })
        })
    }
    if (this.data.xzitem == 4) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "5889eab6ba19ebb012db0392203bf59d06ed5d01", "timestamp": 1677362130, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj4: res.data.data
          })
        })
    }
    if (this.data.xzitem == 5) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "aa7883986c13118f9eb840d33ba5dfb6c4d6f70f", "timestamp": 1677362154, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj5: res.data.data
          })
        })
    }
    setTimeout(() => {
      // 调用wx.stopPullDownRefresh停止下拉刷新动画
      wx.stopPullDownRefresh();
    }, 500);
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    if (this.data.xzitem == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "34eb00b0d73d4c4e221b29c237cf41c8dad2573b", "timestamp": 1677361939, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj.push(e)
            })
            this.setData({
              xwsj: this.data.xwsj
            })
          }else{
            this.data.xwsj = []
            res.data.data.forEach(e => {
              this.data.xwsj.push(e)
            })
            this.setData({
              xwsj: this.data.xwsj
            })
          }
        })
    }
    if (this.data.xzitem == 1) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "866eb6711973721b4de43ab9d9e10f05cb28c149", "timestamp": 1677362000, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj1.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj1.push(e)
            })
            this.setData({
              xwsj1: this.data.xwsj1
            })
          }else{
            this.data.xwsj1 = []
            res.data.data.forEach(e => {
              this.data.xwsj1.push(e)
            })
            this.setData({
              xwsj1: this.data.xwsj1
            })
          }
        })
    }
    if (this.data.xzitem == 2) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "ca5e21d72eddb18647a8e846574ad607880b49d9", "timestamp": 1677362078, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj2.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj2.push(e)
            })
            this.setData({
              xwsj2: this.data.xwsj2
            })
          }else{
            this.data.xwsj2 = []
            res.data.data.forEach(e => {
              this.data.xwsj2.push(e)
            })
            this.setData({
              xwsj2: this.data.xwsj2
            })
          }
        })
    }
    if (this.data.xzitem == 3) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "c95c2da8c303794098d5e86aa447fbbe95a73f4e", "timestamp": 1677362108, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj3.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj3.push(e)
            })
            this.setData({
              xwsj3: this.data.xwsj3
            })
          }else{
            this.data.xwsj3 = []
            res.data.data.forEach(e => {
              this.data.xwsj3.push(e)
            })
            this.setData({
              xwsj3: this.data.xwsj3
            })
          }
        })
    }
    if (this.data.xzitem == 4) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "5889eab6ba19ebb012db0392203bf59d06ed5d01", "timestamp": 1677362130, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj4.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj4.push(e)
            })
            this.setData({
              xwsj4: this.data.xwsj4
            })
          }else{
            this.data.xwsj4 = []
            res.data.data.forEach(e => {
              this.data.xwsj4.push(e)
            })
            this.setData({
              xwsj4: this.data.xwsj4
            })
          }
        })
    }
    if (this.data.xzitem == 5) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "aa7883986c13118f9eb840d33ba5dfb6c4d6f70f", "timestamp": 1677362154, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          if (this.data.xwsj5.length < 80) {
            res.data.data.forEach(e => {
              this.data.xwsj5.push(e)
            })
            this.setData({
              xwsj5: this.data.xwsj5
            })
          }else{
            this.data.xwsj5 = []
            res.data.data.forEach(e => {
              this.data.xwsj5.push(e)
            })
            this.setData({
              xwsj5: this.data.xwsj5
            })
          }
        })
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  djbq(event) {
    let title = ` ${event.detail.name}`
    this.setData({
      xzitem: title
    })
    if (title == 0 && this.data.xwsj.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "34eb00b0d73d4c4e221b29c237cf41c8dad2573b", "timestamp": 1677361939, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj: res.data.data
          })
        })
    }
    if (title == 1 && this.data.xwsj1.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "866eb6711973721b4de43ab9d9e10f05cb28c149", "timestamp": 1677362000, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj1: res.data.data
          })
        })
    }
    if (title == 2 && this.data.xwsj2.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "ca5e21d72eddb18647a8e846574ad607880b49d9", "timestamp": 1677362078, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj2: res.data.data
          })
        })
    }
    if (title == 3 && this.data.xwsj3.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "c95c2da8c303794098d5e86aa447fbbe95a73f4e", "timestamp": 1677362108, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj3: res.data.data
          })
        })
    }
    if (title == 4 && this.data.xwsj4.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "5889eab6ba19ebb012db0392203bf59d06ed5d01", "timestamp": 1677362130, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj4: res.data.data
          })
        })
    }
    if (title == 5 && this.data.xwsj5.length == 0) {
      function postJson(url, data) {
        return axios.post(url, data, {
          headers: {
            'Content-Type': 'application/json'
          }
        });
      }
      postJson("http://api.sunyshine.cn/pull_new", { "abtests": "recall_topics%3Afalse%3B", "ac": "WIFI", "app_channel": "oppo_anquan", "app_text_size": 100, "appid": "xwzzd", "authorization": "0.0.1.833F369812D6822BA02F9C7B91F91964A8046CA3418D075897E9CA06453220811852F50CFA686C1E72F613C06EF0819806BDF521BA8EB3488ADDE36F2314EAF74D0EAB5BD301259B909676DED8BC5C6D4A8EC8D533664057A774E4A8D97472FD01026B82517084DDB636215A2C3A6CFBA8258EB637E231C7697FDF603D59184287392B7411893DD1549185397F2AE8D88013BD759C21D02D239A1E923C6CF152DD2B365A26CDB75269E07F54E6D1F939", "city": "", "clientversion": "2.05", "content_category": "北青首页", "content_channel": "rcmd", "count": 24, "device_type": "MuMu", "iid": "279ca89c-39b0-4fb5-8e31-3505bd2a13f1", "install_time": 1677226569642, "is_refresh": "1", "latitude": "0.0", "longitude": "0.0", "manifest_version_code": 32160, "openudid": "", "os_api": 23, "os_version": "6.0.1", "screen_height": 1600, "screen_width": 900, "source": "BAIDU", "system_text_size": 1.0, "ticket": "aa7883986c13118f9eb840d33ba5dfb6c4d6f70f", "timestamp": 1677362154, "uuid": "863323049409586", "volcengine_abtests": "false", "volcengine_abtests_value": "" })
        .then((res) => {
          var now = Date.now() / 1000;
          function timestampToDate(timestamp) { return new Date(timestamp * 1000); }
          function dateToString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + month + "-" + day + " " + hour + ": " + minute + ": " + second; }
          function timestampToRelative(timestamp) {
            var delta = now - timestamp;
            if (delta < 60) {
              return "刚刚";
              // 如果时间差小于3600秒（1小时），返回“x分钟前”
            } else if (delta < 3600) {
              return Math.floor(delta / 60) + "分钟前";
              // 如果时间差小于86400秒（1天），返回“x小时前”
            } else if (delta < 86400) {
              return Math.floor(delta / 3600) + "小时前";
              // 如果时间差小于604800秒（7天），返回“x天前”
            } else if (delta < 604800) {
              return Math.floor(delta / 86400) + "天前";
              // 否则，返回完整的日期字符串
            } else {
              return dateToString(timestampToDate(timestamp));
            }
          }
          res.data.data.filter(e => {
            e.publish_time = timestampToRelative(e.publish_time)
          })
          this.setData({
            xwsj5: res.data.data
          })
        })
    }
  },
  djtzbdym(e){
    const app = getApp ()
    wx.navigateTo({
      url: '../index2/index',
    })
    app.globalData.wylj = e.currentTarget.dataset.id
  }
})